// Learn cc.Class:
//  - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/class.html
//  - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/class.html
// Learn Attribute:
//  - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
//  - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
//  - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/life-cycle-callbacks.html
var BaseNode = require('./../../FrameWork/Component/BaseNode');
cc.Class({
    extends: BaseNode,
    properties: {
        icon: {
            default: null,
            type: cc.Sprite,
            displayName: '精灵对象'
        },
        spriteAtlasPkCommon: {
            default: null,
            type: cc.SpriteAtlas,
            displayName: '扑克通用资源'
        },
        spriteAtlasPkCards: {
            default: null,
            type: cc.SpriteAtlas,
            displayName: '扑克通用资源'
        },
    },

    setScore(_score) {
        var spriteName = 'score_' + _score.toString();
        var spriteFrame = this.spriteAtlasPkCommon.getSpriteFrame(spriteName);
        this.icon.spriteFrame = spriteFrame;
    },

    setDouble(_double) {
        var spriteName = 'double_' + _double.toString();
        var spriteFrame = this.spriteAtlasPkCommon.getSpriteFrame(spriteName);
        this.icon.spriteFrame = spriteFrame;
    },
    showLandlordTag() {
        var spriteFrame = this.spriteAtlasPkCommon.getSpriteFrame('iconLandlord');
        this.icon.spriteFrame = spriteFrame;
        this.setContentSize(cc.size(38, 50));
    },
    showDoubleIcon() {
        var spriteFrame = this.spriteAtlasPkCommon.getSpriteFrame('icon_head_double');
        this.icon.spriteFrame = spriteFrame;
    },
    /**
     * 牌背
     */
    showCardBg() {
        var spriteFrame = this.spriteAtlasPkCommon.getSpriteFrame('card_back');
        this.icon.spriteFrame = spriteFrame;
        this.setContentSize(cc.size(20, 100));
    },
});